<?php


class Module_User_Role
{
    private static $obj = null;
    private $model = null;


    /**
     * 封闭构造
     */
    private function __construct()
    {

        $this->model = new Model_User_Role();

    }

    /**
     * 单例获取
     * 保证一条进程只产生一个Module对象
     */
    public static function getInstance()
    {
        if (empty (self::$obj)) {
            self::$obj = new self();;
        }
        return self::$obj;
    }

    /**获取全部数据
     * @return mixed
     */
    public function getListAll()
    {
        return $this->model->getListAll();
    }

    /**
     * @param $role_id
     * @return mixed
     */
    public function getProvisioningByRoleId($role_id)
    {
        return $this->model->getProvisioningByRoleId($role_id);
    }

    /**
     * @param array $fields
     * @param array $search
     * @param bool $cache
     * @return mixed
     */
    function getAllBySearch($fields = array(), $search = array(), $cache = false)
    {
        return $this->model->getAllBySearch($fields, $search, $cache);
    }

    /**
     * @param $id
     * @return mixed
     */
    public function getRoleById($id)
    {
        return $this->model->getRoleById($id);
    }

    /**
     * @param $id
     * @return mixed
     */
    public function deleteById($id)
    {
        return $this->model->deleteById($id);
    }

    /*
     * 存储数据
     */
    public function insertData($saveData)
    {
        return $this->model->insertData($saveData);
    }

    /**
     * @param $updateData
     * @return mixed
     */
    public function updateItemById($updateData)
    {
        return $this->model->updateItemById($updateData);
    }

    /**
     * @param $title
     * @return array
     */
    public function getByTitle($title)
    {
        return $this->model->getByTitle($title);
    }
}